<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: MiximRadio Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00141.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">MiximRadio Class Reference<div class="ingroups"><a class="el" href="a00510.html">phyLayer - physical layer modules</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="MiximRadio" -->
<p>The class that represents the Radio as a state machine.  
 <a href="a00141.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00303_source.html">PhyUtils.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for MiximRadio:</div>
<div class="dyncontent">
<div class="center"><img src="a00864.png" border="0" usemap="#MiximRadio_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for MiximRadio:</div>
<div class="dyncontent">
<div class="center"><img src="a00865.png" border="0" usemap="#MiximRadio_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00866.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7">RadioState</a> { <br/>
&#160;&#160;<a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7a2c1aea88fe8363141c138da817461953">RX</a> =  0, 
<a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7a4f6c3dfae0f5fccb76b1d42f6ccc785d">TX</a>, 
<a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7afd684ca0a1c84f153dec831272ccde42">SLEEP</a>, 
<a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde">SWITCHING</a>, 
<br/>
&#160;&#160;<a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7ac1eb11ffe24036a5e7c1a07035db2bba">NUM_RADIO_STATES</a>
<br/>
 }</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The state of the radio of the nic.  <a href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adc703b5fd595855042bf384d09fdcc07"></a><!-- doxytag: member="MiximRadio::~MiximRadio" ref="adc703b5fd595855042bf384d09fdcc07" args="()" -->
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#adc703b5fd595855042bf384d09fdcc07">~MiximRadio</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor for the Radio class. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual simtime_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a1502d8706569eb031bde5c1c29f5bedb">switchTo</a> (int newState, simtime_t_cref now)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A function called by the Physical Layer to start the switching process to a new RadioState.  <a href="#a1502d8706569eb031bde5c1c29f5bedb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a11843592ab0d8526823ce0478d9eb19a"></a><!-- doxytag: member="MiximRadio::setSwitchTime" ref="a11843592ab0d8526823ce0478d9eb19a" args="(int from, int to, simtime_t_cref time)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a11843592ab0d8526823ce0478d9eb19a">setSwitchTime</a> (int from, int to, simtime_t_cref time)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">function called by <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> in order to make an entry in the switch times matrix, i.e. set the time for switching from one state to another <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a234ab13c02b2b3ca369f9b18aace0e44"></a><!-- doxytag: member="MiximRadio::getCurrentState" ref="a234ab13c02b2b3ca369f9b18aace0e44" args="() const " -->
virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a234ab13c02b2b3ca369f9b18aace0e44">getCurrentState</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the state the Radio is currently in. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ae9820653aa09c297148210c1de27a2e1">endSwitch</a> (simtime_t_cref now)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">called by <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> when duration-time for the current switching process is up  <a href="#ae9820653aa09c297148210c1de27a2e1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="a00182.html">RadioStateAnalogueModel</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a6adb7b66381adb5e7914e79c94fda6fe">getAnalogueModel</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a>.  <a href="#a6adb7b66381adb5e7914e79c94fda6fe"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab7612ad466891148d016c34cb6c639dd"></a><!-- doxytag: member="MiximRadio::cleanAnalogueModelUntil" ref="ab7612ad466891148d016c34cb6c639dd" args="(simtime_t_cref t)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ab7612ad466891148d016c34cb6c639dd">cleanAnalogueModelUntil</a> (simtime_t_cref t)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">discards information in the <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a> before given time-point <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ababfbdc6756083fa034c65cc474289b6"></a><!-- doxytag: member="MiximRadio::setTrackingModeTo" ref="ababfbdc6756083fa034c65cc474289b6" args="(bool b)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ababfbdc6756083fa034c65cc474289b6">setTrackingModeTo</a> (bool b)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">sets tracking mode <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ad98b2835fa230f9d042329c37aee89ef">setCurrentChannel</a> (int newChannel)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Changes the current channel of the radio.  <a href="#ad98b2835fa230f9d042329c37aee89ef"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a6b1bfd335fd212c52c65eeb6a36b0851">getCurrentChannel</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the channel the radio is currently set to.  <a href="#a6b1bfd335fd212c52c65eeb6a36b0851"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ae0550827a03c3a0a5dd10c8957e5e014">getNbChannels</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of channels.  <a href="#ae0550827a03c3a0a5dd10c8957e5e014"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="a00141.html">MiximRadio</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#af9b90cb1028bad49bbcc2076ff96ec3b">createNewRadio</a> (bool recordStats=false, int initialState=RX, Argument::mapped_type_cref <a class="el" href="a00141.html#a891a34f0c4280d790bd6d97db8270977">minAtt</a>=<a class="el" href="a00013.html#a657d962a1b965814e6b2eecb07f03e80">Argument::MappedOne</a>, Argument::mapped_type_cref <a class="el" href="a00141.html#a26aaf48126840634a094e8223d121259">maxAtt</a>=<a class="el" href="a00013.html#a8523627cdc70492e5e0935b9a3a78cc4">Argument::MappedZero</a>, int <a class="el" href="a00141.html#a077c78d3f30dc9932974a50911f18d66">currentChannel</a>=0, int <a class="el" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391">nbChannels</a>=1)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new instance of this class.  <a href="#af9b90cb1028bad49bbcc2076ff96ec3b"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a08447789a4be7232d6353f9aa9737cc8">MiximRadio</a> (int <a class="el" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4">numRadioStates</a>, bool recordStats, int initialState=RX, Argument::mapped_type_cref <a class="el" href="a00141.html#a891a34f0c4280d790bd6d97db8270977">minAtt</a>=<a class="el" href="a00013.html#a657d962a1b965814e6b2eecb07f03e80">Argument::MappedOne</a>, Argument::mapped_type_cref <a class="el" href="a00141.html#a26aaf48126840634a094e8223d121259">maxAtt</a>=<a class="el" href="a00013.html#a8523627cdc70492e5e0935b9a3a78cc4">Argument::MappedZero</a>, int <a class="el" href="a00141.html#a077c78d3f30dc9932974a50911f18d66">currentChannel</a>=0, int <a class="el" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391">nbChannels</a>=1)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Intern constructor to initialize the radio.  <a href="#a08447789a4be7232d6353f9aa9737cc8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aef828c78b65e04eb308929880d2ac8f7"></a><!-- doxytag: member="MiximRadio::makeRSAMEntry" ref="aef828c78b65e04eb308929880d2ac8f7" args="(simtime_t_cref time, int state)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#aef828c78b65e04eb308929880d2ac8f7">makeRSAMEntry</a> (simtime_t_cref time, int <a class="el" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0">state</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">responsible for making entries to the RSAM <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8fb94b6085e7ee54877407a111755fc1"></a><!-- doxytag: member="MiximRadio::mapStateToAtt" ref="a8fb94b6085e7ee54877407a111755fc1" args="(int state)" -->
virtual Argument::mapped_type_cref&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a8fb94b6085e7ee54877407a111755fc1">mapStateToAtt</a> (int <a class="el" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0">state</a>)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">maps RadioState to attenuation, the Radios receiving characteristic <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4f8c9dfcdfbc489750bef92bb96738a0"></a><!-- doxytag: member="MiximRadio::radioStates" ref="a4f8c9dfcdfbc489750bef92bb96738a0" args="" -->
cOutVector&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0">radioStates</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Output vector for radio states. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7582bf7ba1ae0ef65727f577f125eb15"></a><!-- doxytag: member="MiximRadio::radioChannels" ref="a7582bf7ba1ae0ef65727f577f125eb15" args="" -->
cOutVector&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15">radioChannels</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Output vector for radio channels. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa735fae8f7e81f7b3a56b651401c79d0"></a><!-- doxytag: member="MiximRadio::state" ref="aa735fae8f7e81f7b3a56b651401c79d0" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0">state</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The current state the radio is in. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae774d34df7824189236e45fd71b32f29"></a><!-- doxytag: member="MiximRadio::nextState" ref="ae774d34df7824189236e45fd71b32f29" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ae774d34df7824189236e45fd71b32f29">nextState</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The state the radio is currently switching to. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab8dcd5c21a53188f161572a123058ae4"></a><!-- doxytag: member="MiximRadio::numRadioStates" ref="ab8dcd5c21a53188f161572a123058ae4" args="" -->
const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4">numRadioStates</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The number of radio states this Radio can be in. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="add7d1a73e066b8c7e2bfd823fa3c80fa"></a><!-- doxytag: member="MiximRadio::swTimes" ref="add7d1a73e066b8c7e2bfd823fa3c80fa" args="" -->
simtime_t **&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa">swTimes</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Array for storing switch-times between states. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a891a34f0c4280d790bd6d97db8270977"></a><!-- doxytag: member="MiximRadio::minAtt" ref="a891a34f0c4280d790bd6d97db8270977" args="" -->
const Argument::mapped_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a891a34f0c4280d790bd6d97db8270977">minAtt</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constant to store the minimum attenuation for a Radio instance. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26aaf48126840634a094e8223d121259"></a><!-- doxytag: member="MiximRadio::maxAtt" ref="a26aaf48126840634a094e8223d121259" args="" -->
const Argument::mapped_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a26aaf48126840634a094e8223d121259">maxAtt</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constant to store the maximum attenuation for a Radio instance. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00182.html">RadioStateAnalogueModel</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#aca63047443fe045ae60a3fc13ef54b26">rsam</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The corresponding <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a>.  <a href="#aca63047443fe045ae60a3fc13ef54b26"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a077c78d3f30dc9932974a50911f18d66"></a><!-- doxytag: member="MiximRadio::currentChannel" ref="a077c78d3f30dc9932974a50911f18d66" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a077c78d3f30dc9932974a50911f18d66">currentChannel</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Currently selected channel (varies between 0 and nbChannels-1). <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b6d4eefb5e646ea73c1efe80d732391"></a><!-- doxytag: member="MiximRadio::nbChannels" ref="a0b6d4eefb5e646ea73c1efe80d732391" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391">nbChannels</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of available channels. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4a8c6205ab4d9cb0215b0f092dae2f3c"></a><!-- doxytag: member="MiximRadio::MiximRadio" ref="a4a8c6205ab4d9cb0215b0f092dae2f3c" args="(const MiximRadio &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a4a8c6205ab4d9cb0215b0f092dae2f3c">MiximRadio</a> (const <a class="el" href="a00141.html">MiximRadio</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8644fdd75f0c6da3e6f28f29e3490099"></a><!-- doxytag: member="MiximRadio::operator=" ref="a8644fdd75f0c6da3e6f28f29e3490099" args="(const MiximRadio &amp;)" -->
<a class="el" href="a00141.html">MiximRadio</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00141.html#a8644fdd75f0c6da3e6f28f29e3490099">operator=</a> (const <a class="el" href="a00141.html">MiximRadio</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The class that represents the Radio as a state machine. </p>
<p>The Radio creates and updates its corresponding <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a>, that is a filter representing the radios attenuation to a <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> depending on the RadioState over time.</p>
<p>For this basic version we assume a minimal attenuation when the Radio is in state RX, and a maximum attenuation otherwise.</p>
<p>A state-machine-diagram for Radio, <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a> and <a class="el" href="a00043.html" title="This class is used by the BasePhyLayer to keep track of the AirFrames on the channel.">ChannelInfo</a> showing how they work together under control of <a class="el" href="a00029.html" title="The BasePhyLayer represents the physical layer of a nic.">BasePhyLayer</a> as well as some documentation on how <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a> works is available in <a class="el" href="a00510.html">phyLayer - physical layer modules</a>. </p>
</div><hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7"></a><!-- doxytag: member="MiximRadio::RadioState" ref="a5d69aacb1cf6a57827f07224219fccb7" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7">MiximRadio::RadioState</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The state of the radio of the nic. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7a2c1aea88fe8363141c138da817461953"></a><!-- doxytag: member="RX" ref="a5d69aacb1cf6a57827f07224219fccb7a2c1aea88fe8363141c138da817461953" args="" -->RX</em>&nbsp;</td><td>
<p>receiving state </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7a4f6c3dfae0f5fccb76b1d42f6ccc785d"></a><!-- doxytag: member="TX" ref="a5d69aacb1cf6a57827f07224219fccb7a4f6c3dfae0f5fccb76b1d42f6ccc785d" args="" -->TX</em>&nbsp;</td><td>
<p>transmitting state </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7afd684ca0a1c84f153dec831272ccde42"></a><!-- doxytag: member="SLEEP" ref="a5d69aacb1cf6a57827f07224219fccb7afd684ca0a1c84f153dec831272ccde42" args="" -->SLEEP</em>&nbsp;</td><td>
<p>sleeping </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde"></a><!-- doxytag: member="SWITCHING" ref="a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" args="" -->SWITCHING</em>&nbsp;</td><td>
<p>switching between two states </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a5d69aacb1cf6a57827f07224219fccb7ac1eb11ffe24036a5e7c1a07035db2bba"></a><!-- doxytag: member="NUM_RADIO_STATES" ref="a5d69aacb1cf6a57827f07224219fccb7ac1eb11ffe24036a5e7c1a07035db2bba" args="" -->NUM_RADIO_STATES</em>&nbsp;</td><td>
<p>No real radio state just a counter constant for the amount of states. </p>
<p>Sub-classing Radios which want to add more states can add their own states in their own enum beginning at the value of NUM_RADIO_STATES. They should also remember to update the "numRadioStates" member accordingly.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00183.html" title="This class extends the basic radio model.">RadioUWBIR</a> for an example. </dd></dl>
</td></tr>
</table>
</dd>
</dl>
<div class="fragment"><pre class="fragment">                  {
    <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7a2c1aea88fe8363141c138da817461953" title="receiving state">RX</a> = 0,
    <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7a4f6c3dfae0f5fccb76b1d42f6ccc785d" title="transmitting state">TX</a>,
    <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7afd684ca0a1c84f153dec831272ccde42" title="sleeping">SLEEP</a>,
    <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" title="switching between two states">SWITCHING</a>,

    <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7ac1eb11ffe24036a5e7c1a07035db2bba" title="No real radio state just a counter constant for the amount of states.">NUM_RADIO_STATES</a>
  };
</pre></div>
</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a08447789a4be7232d6353f9aa9737cc8"></a><!-- doxytag: member="MiximRadio::MiximRadio" ref="a08447789a4be7232d6353f9aa9737cc8" args="(int numRadioStates, bool recordStats, int initialState=RX, Argument::mapped_type_cref minAtt=Argument::MappedOne, Argument::mapped_type_cref maxAtt=Argument::MappedZero, int currentChannel=0, int nbChannels=1)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">MiximRadio::MiximRadio </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>numRadioStates</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>recordStats</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>initialState</em> = <code>RX</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Argument::mapped_type_cref&#160;</td>
          <td class="paramname"><em>minAtt</em> = <code><a class="el" href="a00013.html#a657d962a1b965814e6b2eecb07f03e80">Argument::MappedOne</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Argument::mapped_type_cref&#160;</td>
          <td class="paramname"><em>maxAtt</em> = <code><a class="el" href="a00013.html#a8523627cdc70492e5e0935b9a3a78cc4">Argument::MappedZero</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>currentChannel</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>nbChannels</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Intern constructor to initialize the radio. </p>
<p>By defining no default constructor we assure that sub classing radios have to explicitly call this constructor which assures they pass the correct number of radio states.</p>
<p>The protected constructor + factory method solution assures that while sub-classing Radios HAVE to explicitly pass their correct amount of radio states to this constructor, the user (creator) of the Radio doesn't has to pass it or even know about it (which wouldn't be possible with a public constructor). Therefore sub classing Radios which could be sub-classed further should also do it this way. </p>

<p>References <a class="el" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4">numRadioStates</a>, <a class="el" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15">radioChannels</a>, <a class="el" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0">radioStates</a>, and <a class="el" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa">swTimes</a>.</p>
<div class="fragment"><pre class="fragment">                                          :
  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>(), <a class="code" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15" title="Output vector for radio channels.">radioChannels</a>(), <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>(initialState), <a class="code" href="a00141.html#ae774d34df7824189236e45fd71b32f29" title="The state the radio is currently switching to.">nextState</a>(initialState),
  <a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>(<a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>),
  <a class="code" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa" title="Array for storing switch-times between states.">swTimes</a>(NULL),
  <a class="code" href="a00141.html#a891a34f0c4280d790bd6d97db8270977" title="Constant to store the minimum attenuation for a Radio instance.">minAtt</a>(<a class="code" href="a00141.html#a891a34f0c4280d790bd6d97db8270977" title="Constant to store the minimum attenuation for a Radio instance.">minAtt</a>), <a class="code" href="a00141.html#a26aaf48126840634a094e8223d121259" title="Constant to store the maximum attenuation for a Radio instance.">maxAtt</a>(<a class="code" href="a00141.html#a26aaf48126840634a094e8223d121259" title="Constant to store the maximum attenuation for a Radio instance.">maxAtt</a>),
  <a class="code" href="a00141.html#aca63047443fe045ae60a3fc13ef54b26" title="The corresponding RadioStateAnalogueModel.">rsam</a>(<a class="code" href="a00141.html#a8fb94b6085e7ee54877407a111755fc1" title="maps RadioState to attenuation, the Radios receiving characteristic">mapStateToAtt</a>(initialState)),
  <a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>(<a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>), <a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>(<a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>)
{
  assert(<a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a> &gt; 0);
  assert(<a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a> &gt; -1);
  assert(<a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a> &lt; <a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>);

  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>.setName(<span class="stringliteral">&quot;RadioState&quot;</span>);
  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>.setEnabled(recordStats);
  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>.record(initialState);
  <a class="code" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15" title="Output vector for radio channels.">radioChannels</a>.setName(<span class="stringliteral">&quot;RadioChannel&quot;</span>);
  <a class="code" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15" title="Output vector for radio channels.">radioChannels</a>.setEnabled(recordStats);
  <a class="code" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15" title="Output vector for radio channels.">radioChannels</a>.record(<a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>);

  <span class="comment">// allocate memory for one dimension</span>
  <a class="code" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa" title="Array for storing switch-times between states.">swTimes</a> = <span class="keyword">new</span> simtime_t* [<a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>];

  <span class="comment">// go through the first dimension and</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>; i++)
  {
    <span class="comment">// allocate memory for the second dimension</span>
    <a class="code" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa" title="Array for storing switch-times between states.">swTimes</a>[i] = <span class="keyword">new</span> simtime_t[<a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>];
  }

  <span class="comment">// initialize all matrix entries to 0.0</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>; i++)
  {
    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; <a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>; j++)
    {
      <a class="code" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa" title="Array for storing switch-times between states.">swTimes</a>[i][j] = 0;
    }
  }
}
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="af9b90cb1028bad49bbcc2076ff96ec3b"></a><!-- doxytag: member="MiximRadio::createNewRadio" ref="af9b90cb1028bad49bbcc2076ff96ec3b" args="(bool recordStats=false, int initialState=RX, Argument::mapped_type_cref minAtt=Argument::MappedOne, Argument::mapped_type_cref maxAtt=Argument::MappedZero, int currentChannel=0, int nbChannels=1)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="a00141.html">MiximRadio</a>* MiximRadio::createNewRadio </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>recordStats</em> = <code>false</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>initialState</em> = <code>RX</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Argument::mapped_type_cref&#160;</td>
          <td class="paramname"><em>minAtt</em> = <code><a class="el" href="a00013.html#a657d962a1b965814e6b2eecb07f03e80">Argument::MappedOne</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">Argument::mapped_type_cref&#160;</td>
          <td class="paramname"><em>maxAtt</em> = <code><a class="el" href="a00013.html#a8523627cdc70492e5e0935b9a3a78cc4">Argument::MappedZero</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>currentChannel</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>nbChannels</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [inline, static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a new instance of this class. </p>
<p>Since Radio hasn't a public constructor this is the only way to create an instance of this class.</p>
<p>This method assures that the radio is initialized with the correct number of radio states. Sub classing Radios should also define a factory method like this instead of an public constructor. </p>

<p>Referenced by <a class="el" href="a00029.html#aad75440994998cc89ef7028528197cb7">BasePhyLayer::initializeRadio()</a>.</p>
<div class="fragment"><pre class="fragment">  {
    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="a00141.html#a4a8c6205ab4d9cb0215b0f092dae2f3c" title="Copy constructor is not allowed.">MiximRadio</a>(<a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7ac1eb11ffe24036a5e7c1a07035db2bba" title="No real radio state just a counter constant for the amount of states.">NUM_RADIO_STATES</a>,
                                 recordStats,
                                 initialState,
                                 <a class="code" href="a00141.html#a891a34f0c4280d790bd6d97db8270977" title="Constant to store the minimum attenuation for a Radio instance.">minAtt</a>, <a class="code" href="a00141.html#a26aaf48126840634a094e8223d121259" title="Constant to store the maximum attenuation for a Radio instance.">maxAtt</a>,
                                 <a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>, <a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>);
  }
</pre></div>
</div>
</div>
<a class="anchor" id="ae9820653aa09c297148210c1de27a2e1"></a><!-- doxytag: member="MiximRadio::endSwitch" ref="ae9820653aa09c297148210c1de27a2e1" args="(simtime_t_cref now)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MiximRadio::endSwitch </td>
          <td>(</td>
          <td class="paramtype">simtime_t_cref&#160;</td>
          <td class="paramname"><em>now</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>called by <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> when duration-time for the current switching process is up </p>
<p>Radio checks whether it is in switching state (pre-condition) and switches to the target state</p>
<p>The actual simtime must be passed, to create properly RSAMEntry </p>

<p>References <a class="el" href="a00141.html#aef828c78b65e04eb308929880d2ac8f7">makeRSAMEntry()</a>, <a class="el" href="a00141.html#ae774d34df7824189236e45fd71b32f29">nextState</a>, <a class="el" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0">radioStates</a>, <a class="el" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0">state</a>, and <a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde">SWITCHING</a>.</p>

<p>Referenced by <a class="el" href="a00029.html#aa1de743a3d3ba652c1f3b84b34585743">BasePhyLayer::finishRadioSwitching()</a>, <a class="el" href="a00183.html#a1cdcafe6ddd11881a67a519f5ca90f82">RadioUWBIR::finishReceivingFrame()</a>, and <a class="el" href="a00183.html#a2fe9963465ed09e02428c4949a85d56b">RadioUWBIR::startReceivingFrame()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// make sure we are currently switching</span>
  assert(<a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a> == <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" title="switching between two states">SWITCHING</a>);

  <span class="comment">// set the current state finally to the next state</span>
  <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a> = <a class="code" href="a00141.html#ae774d34df7824189236e45fd71b32f29" title="The state the radio is currently switching to.">nextState</a>;
  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>.record(<a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>);

  <span class="comment">// make entry to RSAM</span>
  <a class="code" href="a00141.html#aef828c78b65e04eb308929880d2ac8f7" title="responsible for making entries to the RSAM">makeRSAMEntry</a>(now, <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>);

  <span class="keywordflow">return</span>;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a6adb7b66381adb5e7914e79c94fda6fe"></a><!-- doxytag: member="MiximRadio::getAnalogueModel" ref="a6adb7b66381adb5e7914e79c94fda6fe" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual <a class="el" href="a00182.html">RadioStateAnalogueModel</a>* MiximRadio::getAnalogueModel </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns a pointer to the <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a>. </p>
<p>This method is intended to be used by the <a class="el" href="a00173.html" title="Provides initialisation for several AnalogueModels and Deciders from modules directory.">PhyLayer</a> to obtain a pointer to the corresponding RSAM to this Radio </p>

<p>Referenced by <a class="el" href="a00029.html#af578e3fbeacc12b639dd5f072215bac5">BasePhyLayer::getAnalogueModelFromName()</a>, and <a class="el" href="a00029.html#a0fc69907490ed2752d2a888ef26348ff">BasePhyLayer::~BasePhyLayer()</a>.</p>
<div class="fragment"><pre class="fragment">                                                      {
    <span class="keywordflow">return</span> (&amp;<a class="code" href="a00141.html#aca63047443fe045ae60a3fc13ef54b26" title="The corresponding RadioStateAnalogueModel.">rsam</a>);
  }
</pre></div>
</div>
</div>
<a class="anchor" id="a6b1bfd335fd212c52c65eeb6a36b0851"></a><!-- doxytag: member="MiximRadio::getCurrentChannel" ref="a6b1bfd335fd212c52c65eeb6a36b0851" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int MiximRadio::getCurrentChannel </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the channel the radio is currently set to. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The current channel of the radio, between 0 and nbChannels-1. </dd></dl>

<p>Referenced by <a class="el" href="a00175.html#a580a9a246bc519e8c4f97a5381a8877b">PhyLayerUWBIR::encapsMsg()</a>, <a class="el" href="a00029.html#a9e03a4078cc2d1c4214249120901321c">BasePhyLayer::encapsMsg()</a>, and <a class="el" href="a00029.html#a78d08dafa6b53482145a7fe6adf30648">BasePhyLayer::getCurrentRadioChannel()</a>.</p>
<div class="fragment"><pre class="fragment">                                {
    <span class="keywordflow">return</span> <a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>;
  }
</pre></div>
</div>
</div>
<a class="anchor" id="ae0550827a03c3a0a5dd10c8957e5e014"></a><!-- doxytag: member="MiximRadio::getNbChannels" ref="ae0550827a03c3a0a5dd10c8957e5e014" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int MiximRadio::getNbChannels </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the number of channels. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of channels. </dd></dl>

<p>Referenced by <a class="el" href="a00029.html#a30f5f83644568e1be77cc25ea74aaf8b">BasePhyLayer::getNbRadioChannels()</a>.</p>
<div class="fragment"><pre class="fragment">                            {
    <span class="keywordflow">return</span> <a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>;
  }
</pre></div>
</div>
</div>
<a class="anchor" id="ad98b2835fa230f9d042329c37aee89ef"></a><!-- doxytag: member="MiximRadio::setCurrentChannel" ref="ad98b2835fa230f9d042329c37aee89ef" args="(int newChannel)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void MiximRadio::setCurrentChannel </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>newChannel</em></td><td>)</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Changes the current channel of the radio. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">newChannel</td><td>The new channel to switch to, between 0 and nbChannels-1 </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="a00029.html#aa662c2194a72e2c46f6b25e7e6901834">BasePhyLayer::setCurrentRadioChannel()</a>.</p>
<div class="fragment"><pre class="fragment">                                         {
    assert(newChannel &gt; -1);
    assert(newChannel &lt; <a class="code" href="a00141.html#a0b6d4eefb5e646ea73c1efe80d732391" title="Number of available channels.">nbChannels</a>);
    <a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a> = newChannel;
    <a class="code" href="a00141.html#a7582bf7ba1ae0ef65727f577f125eb15" title="Output vector for radio channels.">radioChannels</a>.record(<a class="code" href="a00141.html#a077c78d3f30dc9932974a50911f18d66" title="Currently selected channel (varies between 0 and nbChannels-1).">currentChannel</a>);
  }
</pre></div>
</div>
</div>
<a class="anchor" id="a1502d8706569eb031bde5c1c29f5bedb"></a><!-- doxytag: member="MiximRadio::switchTo" ref="a1502d8706569eb031bde5c1c29f5bedb" args="(int newState, simtime_t_cref now)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">simtime_t MiximRadio::switchTo </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>newState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">simtime_t_cref&#160;</td>
          <td class="paramname"><em>now</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A function called by the Physical Layer to start the switching process to a new RadioState. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>-1: Error code if the Radio is currently switching else: switching time from the current RadioState to the new RadioState</dd></dl>
<p>The actual simtime must be passed, to create properly RSAMEntry </p>

<p>Reimplemented in <a class="el" href="a00183.html#a4fcf2fff34e2a9d289028ebe13b6ada1">RadioUWBIR</a>.</p>

<p>References <a class="el" href="a00141.html#aef828c78b65e04eb308929880d2ac8f7">makeRSAMEntry()</a>, <a class="el" href="a00141.html#ae774d34df7824189236e45fd71b32f29">nextState</a>, <a class="el" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4">numRadioStates</a>, <a class="el" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0">radioStates</a>, <a class="el" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0">state</a>, <a class="el" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde">SWITCHING</a>, and <a class="el" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa">swTimes</a>.</p>

<p>Referenced by <a class="el" href="a00029.html#a5170b3aadae25dc6b9e61974076be04b">BasePhyLayer::setRadioState()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// state to switch to must be in a valid range, i.e. 0 &lt;= newState &lt; numRadioStates</span>
  assert(0 &lt;= newState &amp;&amp; newState &lt; <a class="code" href="a00141.html#ab8dcd5c21a53188f161572a123058ae4" title="The number of radio states this Radio can be in.">numRadioStates</a>);

  <span class="comment">// state to switch to must not be SWITCHING</span>
  assert(newState != <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" title="switching between two states">SWITCHING</a>);

  <span class="comment">// return error value if newState is the same as the current state</span>
  <span class="comment">// if (newState == state) return -1;</span>

  <span class="comment">// return error value if MiximRadio is currently switching</span>
  <span class="keywordflow">if</span> (<a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a> == <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" title="switching between two states">SWITCHING</a>) <span class="keywordflow">return</span> -1;


  <span class="comment">/* REGULAR CASE */</span>

  <span class="comment">// set the nextState to the newState and the current state to SWITCHING</span>
  <a class="code" href="a00141.html#ae774d34df7824189236e45fd71b32f29" title="The state the radio is currently switching to.">nextState</a> = newState;
  <span class="keywordtype">int</span> lastState = <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>;
  <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a> = <a class="code" href="a00141.html#a5d69aacb1cf6a57827f07224219fccb7adb16d903144a4b227138692871b6edde" title="switching between two states">SWITCHING</a>;
  <a class="code" href="a00141.html#a4f8c9dfcdfbc489750bef92bb96738a0" title="Output vector for radio states.">radioStates</a>.record(<a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>);

  <span class="comment">// make entry to RSAM</span>
  <a class="code" href="a00141.html#aef828c78b65e04eb308929880d2ac8f7" title="responsible for making entries to the RSAM">makeRSAMEntry</a>(now, <a class="code" href="a00141.html#aa735fae8f7e81f7b3a56b651401c79d0" title="The current state the radio is in.">state</a>);

  <span class="comment">// return matching entry from the switch times matrix</span>
  <span class="keywordflow">return</span> <a class="code" href="a00141.html#add7d1a73e066b8c7e2bfd823fa3c80fa" title="Array for storing switch-times between states.">swTimes</a>[lastState][<a class="code" href="a00141.html#ae774d34df7824189236e45fd71b32f29" title="The state the radio is currently switching to.">nextState</a>];
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="aca63047443fe045ae60a3fc13ef54b26"></a><!-- doxytag: member="MiximRadio::rsam" ref="aca63047443fe045ae60a3fc13ef54b26" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00182.html">RadioStateAnalogueModel</a> <a class="el" href="a00141.html#aca63047443fe045ae60a3fc13ef54b26">MiximRadio::rsam</a><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The corresponding <a class="el" href="a00182.html" title="This special AnalogueModel provides filtering of a Signal according to the actual RadioStates the Rad...">RadioStateAnalogueModel</a>. </p>
<p>Depends on the characteristics of the radio </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/phyLayer/<a class="el" href="a00303_source.html">PhyUtils.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/phyLayer/PhyUtils.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00141.html">MiximRadio</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:32 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
